<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div class="app">
        性：<input type="text" v-model="firstname"> <br> 名：
        <input type="text" v-model="lastname"> <br>{{name}}
    </div>

    <script>
        const vm = new Vue({
            data: {
                firstname: "张",
                lastname: "三",
            },
            computed: {
                name: {
                    get() {
                        return this.firstname + this.lastname
                    },
                    set() { //监听数据的改变
                        console.log('你修改的数据');
                    }
                }
            },
            mounted() {

            },
            created() {

            },
        }).$mount(".app")
    </script>
</body>

</html>